home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / text / html / parser / Element.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-07-15  |  2.6 KB  |  98 lines

  1. package javax.swing.text.html.parser;
  2.  
  3. import java.io.Serializable;
  4. import java.util.BitSet;
  5. import java.util.Hashtable;
  6.  
  7. public final class Element implements DTDConstants, Serializable {
  8.    public int index;
  9.    public String name;
  10.    public boolean oStart;
  11.    public boolean oEnd;
  12.    public BitSet inclusions;
  13.    public BitSet exclusions;
  14.    public int type = 19;
  15.    public ContentModel content;
  16.    public AttributeList atts;
  17.    static int maxIndex = 0;
  18.    public Object data;
  19.    static Hashtable contentTypes = new Hashtable();
  20.  
  21.    static {
  22.       contentTypes.put("CDATA", new Integer(1));
  23.       contentTypes.put("RCDATA", new Integer(16));
  24.       contentTypes.put("EMPTY", new Integer(17));
  25.       contentTypes.put("ANY", new Integer(19));
  26.    }
  27.  
  28.    Element() {
  29.    }
  30.  
  31.    Element(String var1, int var2) {
  32.       this.name = var1;
  33.       this.index = var2;
  34.       maxIndex = Math.max(maxIndex, var2);
  35.    }
  36.  
  37.    public AttributeList getAttribute(String var1) {
  38.       for(AttributeList var2 = this.atts; var2 != null; var2 = var2.next) {
  39.          if (var2.name.equals(var1)) {
  40.             return var2;
  41.          }
  42.       }
  43.  
  44.       return null;
  45.    }
  46.  
  47.    public AttributeList getAttributeByValue(String var1) {
  48.       for(AttributeList var2 = this.atts; var2 != null; var2 = var2.next) {
  49.          if (var2.values != null && var2.values.contains(var1)) {
  50.             return var2;
  51.          }
  52.       }
  53.  
  54.       return null;
  55.    }
  56.  
  57.    public AttributeList getAttributes() {
  58.       return this.atts;
  59.    }
  60.  
  61.    public ContentModel getContent() {
  62.       return this.content;
  63.    }
  64.  
  65.    public int getIndex() {
  66.       return this.index;
  67.    }
  68.  
  69.    public String getName() {
  70.       return this.name;
  71.    }
  72.  
  73.    public int getType() {
  74.       return this.type;
  75.    }
  76.  
  77.    public boolean isEmpty() {
  78.       return this.type == 17;
  79.    }
  80.  
  81.    public static int name2type(String var0) {
  82.       Integer var1 = (Integer)contentTypes.get(var0);
  83.       return var1 != null ? var1 : 0;
  84.    }
  85.  
  86.    public boolean omitEnd() {
  87.       return this.oEnd;
  88.    }
  89.  
  90.    public boolean omitStart() {
  91.       return this.oStart;
  92.    }
  93.  
  94.    public String toString() {
  95.       return this.name;
  96.    }
  97. }
  98.